<template>
	<view class="container">
		<uni-list>
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="真实姓名" :rightText="user.name" />
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称"
				:rightText="user.nickName" />
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'phone-filled'}" title="手机号码"
				:rightText="user.phonenumber" />
			<uni-list-item showExtraIcon="true" title="省" :rightText="user.provinces" />
			<uni-list-item showExtraIcon="true" title="市" :rightText="user.city" />
			<uni-list-item showExtraIcon="true" title="区" :rightText="user.county" />
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'email-filled'}" title="详细地址" :rightText="user.address" />
		</uni-list>
	</view>
</template>

<script>
	import {
		getUserProfile
	} from "@/api/system/user"

	export default {
		data() {
			return {
				user: {},
				roleGroup: "",
				postGroup: ""
			}
		},
		onLoad() {
			this.getUser()
		},
		methods: {
			getUser() {
				getUserProfile().then(response => {
			if(response == '401'){
				uni.navigateTo({
					url: '/pages/login',
				});
			}
					this.user = response.data
					this.roleGroup = response.roleGroup
					this.postGroup = response.postGroup
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}
</style>
